package com.lft.com.oilgas.service.impl;

import com.lft.com.oilgas.entity.Driver;
import com.lft.com.oilgas.mapper.DriverMapper;
import com.lft.com.oilgas.service.IDriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tyqw
 * @since 2024-09-10
 */
@Service
public class DriverServiceImpl  implements IDriverService {
    @Autowired
    private DriverMapper driverMapper;

    @Override
    public List<Map> getDriver() {

        return driverMapper.selectDriver();
    }

    @Override
    public int insertAndUpdateDriver(Driver driver) {
        if (driver.getId() != null &&driver.getId()!=0) {
            return driverMapper.updateById(driver);
        } else{
           return driverMapper.insert(driver);
        }
    }
}
